<html>

<head>
    <title>动画</title>
    <style type="text/css">
        canvas {
            border: 1px solid black;
        }
    </style>
</head>

<canvas id="tutorial" width="500" height="500"></canvas>
</body>
<script type="text/javascript">
  function draw() {
    let canvas = document.getElementById('tutorial');
    // 检测支持性
    if (!canvas.getContext) return;
    //获得 2d 上下文对象
    let ctx = canvas.getContext("2d");

  }

  draw();
</script>

</html>